package com.right.service.impl;

import java.util.List;

import com.Tools.PageData;
import com.right.dao.OrderdetailDao;
import com.right.dao.impl.OrderdetailDaoImp;
import com.right.entity.Orderdetail;
import com.right.service.OrderdetailService;

public class OrderdetailServiceImpl implements OrderdetailService {
                 OrderdetailDao dao=new OrderdetailDaoImp();
	@Override
	public boolean addorderdetail(Orderdetail orderdetail) {
		//如果订单详情为空的话则不添加入数据库
		if (orderdetail==null) {
			return false;
		}
		   boolean flag=dao.addorderdetail(orderdetail);
		   return flag;
	}

	@Override
	public boolean delorderdetail(int oid) {
		//判断oid 不小于等于 0 如果不输入时默认为0
	 if (oid<=0) {
		return false;
	}
	      boolean flag=dao.delorderdetail(oid);
	      return flag;
	}

	@Override
	public boolean updateorderdetail(Orderdetail orderdetail) {
	  if (orderdetail==null) {
		return false;
	}
	  boolean flag=dao.updateorderdetail(orderdetail);
		return flag;
	}

	@Override
	public List<Orderdetail> getOrderdetails(String orderid) {
		// TODO Auto-generated method stub
		       return dao.getOrderdetails(orderid);
	}

	@Override
	public PageData<Orderdetail> Orderdetailbypage(int page, int pageSize, String keywords) {
		//如果页码小于1的话 那就给页码重新赋值为1
		if (page<1) {
			page=1;
		}
		return dao.Orderdetailbypage(page, pageSize, keywords);
	}

}
